import plotly.offline as pyo
from plotly.graph_objs import *
import chart_studio.plotly as py
import pandas as pd
from pandas import DataFrame
import plotly.figure_factory as ff
pyo.offline.init_notebook_mode()
df = pd.read_csv(r'../Data/UKCountryPopulation.csv', index_col = 0)
df = df[['Name','Population (2011)', 'Area (km2)']]
df
| Name | Population (2011) | Area (km2) | |
|---|---|---|---|
| 0 | England | 53107169 | 130395 |
| 1 | Scotland | 5299900 | 78772 |
| 2 | Wales | 3063758 | 20779 |
| 3 | Northern Ireland | 1814318 | 13843 |
UKCountryInfo = ff.create_table(df, index='True')
pyo.iplot(UKCountryInfo)
df.set_index('Name', drop=True, inplace = True)
df
| Population (2011) | Area (km2) | |
|---|---|---|
| Name | ||
| England | 53107169 | 130395 |
| Scotland | 5299900 | 78772 |
| Wales | 3063758 | 20779 |
| Northern Ireland | 1814318 | 13843 |
UKCountryInfo = ff.create_table(df, index=True)
pyo.iplot(UKCountryInfo)
UKCountryInfo = ff.create_table(df, index=True, index_title='Country')
pyo.iplot(UKCountryInfo)
df[" "] = ""
df[" "] = ""
df[" "] = ""
df
| Population (2011) | Area (km2) | ||||
|---|---|---|---|---|---|
| Name | |||||
| England | 53107169 | 130395 | |||
| Scotland | 5299900 | 78772 | |||
| Wales | 3063758 | 20779 | |||
| Northern Ireland | 1814318 | 13843 |
df = df[[' ', 'Population (2011)', ' ', 'Area (km2)', ' ']]
df
| Population (2011) | Area (km2) | ||||
|---|---|---|---|---|---|
| Name | |||||
| England | 53107169 | 130395 | |||
| Scotland | 5299900 | 78772 | |||
| Wales | 3063758 | 20779 | |||
| Northern Ireland | 1814318 | 13843 |
UKCountryInfo = ff.create_table(df, index=True, index_title='Country')
pyo.iplot(UKCountryInfo)
df = pd.read_csv(r'../Data/UKCountryPopulation.csv', index_col = 0)
df = df[['Name','Population (2011)', 'Area (km2)']]
df.set_index('Name', drop=True, inplace = True)
UKCountryInfo = ff.create_table(df, index=True, index_title='Country')
UKCountryInfo['layout'].update({'width' : 500})
pyo.iplot(UKCountryInfo)